package com.tyk.bookstore.back.member.model.vo;


import com.tyk.bookstore.back.common.core.model.page.PageVo;
import com.tyk.bookstore.back.common.core.model.type.Gender;
import com.tyk.bookstore.back.common.core.util.FileUtil;
import com.tyk.bookstore.back.member.model.enume.MemberState;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author tyk
 * @description 会员
 */
@Data
public class MemberPageVo extends PageVo<MemberPageVo.Member> {
    @Data
    public static class Member {

        @Schema(description = "ID")
        private Long id;

        @Schema(description = "账号/会员名")
        private String account;

        @Schema(description = "手机号")
        private String phone;

        @Schema(description = "邮箱")
        private String email;

        @Schema(description = "状态[0可用，1禁用，2注销]")
        private MemberState state;

        @Schema(description = "创建时间")
        private LocalDateTime createTime;

        @Schema(description = "更新时间")
        private LocalDateTime updateTime;

        @Schema(description = "昵称")
        private String nickname;

        @Schema(description = "头像路径")
        private String avatar;

        @Schema(description = "性别[0男，1女，2未知]")
        private Gender gender;

        @Schema(description = "生日")
        private LocalDateTime birthday;

        @Schema(description = "身份证号")
        private String idCard;

        public Member setAvatar(String avatar) {
            this.avatar = FileUtil.fullFilePath(avatar);
            return this;
        }
    }
}
